package com.qilu.pe.base;

import com.lzy.imagepicker.ImagePicker;
import com.lzy.imagepicker.view.CropImageView;
import com.qilu.pe.support.util.GlideImageLoader;
import com.ruitu.arad.AradApplication;
import com.ruitu.arad.AradApplicationConfig;

public class MyApp extends AradApplication {

    @Override
    protected AradApplicationConfig appConfig() {
        return new AradApplicationConfig();
    }

    @Override
    public void onCreate() {
        super.onCreate();

        initImageLoader();
    }

    public static void initImageLoader() {
        ImagePicker imagePicker = ImagePicker.getInstance();
        imagePicker.setImageLoader(new GlideImageLoader());   //设置图片加载器
        imagePicker.setShowCamera(true);  //显示拍照按钮
        imagePicker.setCrop(true);        //允许裁剪（单选才有效）
//        imagePicker.setFreeCrop(true, FreeCropImageView.CropMode.FREE);//新版添加,自由裁剪，优先于setCrop
        imagePicker.setSaveRectangle(true); //是否按矩形区域保存
        imagePicker.setSelectLimit(1);    //选中数量限制
        imagePicker.setStyle(CropImageView.Style.RECTANGLE);  //裁剪框的形状
        imagePicker.setFocusWidth(800);   //裁剪框的宽度，仅对crop有效，对isFreeCrop无效
        imagePicker.setFocusHeight(800);  //裁剪框的高度，仅对crop有效，对isFreeCrop无效
        imagePicker.setOutPutX(1000);//保存文件的宽度。单位像素，仅对crop有效，对isFreeCrop无效
        imagePicker.setOutPutY(1000);//保存文件的高度。单位像素，仅对crop有效，对isFreeCrop无效
//        imagePicker.setIToaster(this, new InnerToaster.IToaster());//设置吐司代理,保持lib与app中吐司风格一致
    }
}
